<!DOCTYPE html><html lang="en"><head><title>Reauthorization.aspx</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content=""><meta name="groc-document-path" content="Reauthorization.aspx"><meta name="groc-project-path" content="Reauthorization.aspx.cs"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><script type="text/javascript" src="assets/behavior.js"></script><body><div id="meta"><div class="file-path">Reauthorization.aspx.cs</div></div><div id="document"><div class="segment"><div class="comments "><div class="wrapper"><h2 id="reauthorization-sample">Reauthorization Sample</h2>
<p>Sample showing how to do a reauthorization</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">using</span> PayPal.Api;

namespace PayPal.Sample
{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">partial</span> <span class="hljs-keyword">class</span> Reauthorization : BaseSamplePage
    {
        <span class="hljs-keyword">protected</span> <span class="hljs-keyword">override</span> <span class="hljs-keyword">void</span> <span class="hljs-title">RunSample</span>()
        {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="api-context">Api Context</h3>
<p>Pass in a <code>APIContext</code> object to authenticate 
the call and to send a unique request id 
(that ensures idempotency). The SDK generates
a request id if you do not pass one explicitly. 
See <a href="/Source/Configuration.html">Configuration.cs</a> to know more about APIContext.</p></div></div><div class="code"><div class="wrapper">            <span class="hljs-keyword">var</span> apiContext = Configuration.GetAPIContext();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Make a authorized payment using <code>PayPal Account Payments</code> with intent
as <code>authorize</code>. You can reauthorize a payment only once 4 to 29
days after 3-day honor period for the original authorization
expires.</p></div></div><div class="code"><div class="wrapper">            <span class="hljs-keyword">var</span> authorizationId = <span class="hljs-string">"8HD57954KS1107638"</span>;</div></div></div><div class="segment"><div class="code folded"><div class="wrapper marker"><span class="c1">            // Ignore workflow code segment</span></div><div class="wrapper">            <span class="hljs-comment">// Ignore workflow code segment</span>
            <span class="hljs-preprocessor">#<span class="hljs-keyword">region</span> Track Workflow</span>
            <span class="hljs-keyword">this</span>.flow.AddNewRequest(<span class="hljs-string">"Retrieve payment authorization information"</span>, description: <span class="hljs-string">"ID: "</span> + authorizationId);
            <span class="hljs-preprocessor">#<span class="hljs-keyword">endregion</span></span>
            
            <span class="hljs-keyword">var</span> authorization = Authorization.Get(apiContext, authorizationId);</div></div></div><div class="segment"><div class="code folded"><div class="wrapper marker"><span class="c1">            // Ignore workflow code segment</span></div><div class="wrapper">            <span class="hljs-comment">// Ignore workflow code segment</span>
            <span class="hljs-preprocessor">#<span class="hljs-keyword">region</span> Track Workflow</span>
            <span class="hljs-keyword">this</span>.flow.RecordResponse(authorization);
            <span class="hljs-preprocessor">#<span class="hljs-keyword">endregion</span></span>

            authorization.amount = <span class="hljs-keyword">new</span> Amount()
            {
                currency = <span class="hljs-string">"USD"</span>,
                total = <span class="hljs-string">"1"</span>
            };</div></div></div><div class="segment"><div class="code folded"><div class="wrapper marker"><span class="c1">            // Ignore workflow code segment</span></div><div class="wrapper">            <span class="hljs-comment">// Ignore workflow code segment</span>
            <span class="hljs-preprocessor">#<span class="hljs-keyword">region</span> Track Workflow</span>
            <span class="hljs-keyword">this</span>.flow.AddNewRequest(<span class="hljs-string">"Reauthorize payment"</span>);
            <span class="hljs-preprocessor">#<span class="hljs-keyword">endregion</span></span>
            
            <span class="hljs-keyword">var</span> response = authorization.Reauthorize(apiContext);</div></div></div><div class="segment"><div class="code folded"><div class="wrapper marker"><span class="c1">            // Ignore workflow code segment</span></div><div class="wrapper">            <span class="hljs-comment">// Ignore workflow code segment</span>
            <span class="hljs-preprocessor">#<span class="hljs-keyword">region</span> Track Workflow</span>
            <span class="hljs-keyword">this</span>.flow.RecordResponse(response);
            <span class="hljs-preprocessor">#<span class="hljs-keyword">endregion</span></span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>For more information, please visit <a href="https://developer.paypal.com/docs/api/">PayPal Developer REST API Reference</a>.</p></div></div><div class="code"><div class="wrapper">        }
    }
}</div></div></div></div></body></html>